#include <iostream>
#include <stdlib.h>
#include <vector>
#include <string.h>
using namespace std;

int main(int argc, char** argv){
  //预置选项
  vector<char*> options;
  options.push_back((char*)"-a");
  options.push_back((char*)"-b");
  options.push_back((char*)"-c");
  options.push_back((char*)"-d");
  options.push_back((char*)"-e");

  //查找选项
  for(int i = 1; i < argc; ++i)
  {
    bool ret = false;
    for(auto e : options)
    {
      if(strcmp(e, argv[i]) == 0){
        ret = true;
        cout << "option: " << argv[i] << endl;
        if(strcmp(argv[i], "-e") == 0)
        {
          char *myenv = getenv("MYENV");
          char *home = getenv("HOME");
          if(myenv!=nullptr)
          cout << "MYENV:" << myenv << endl;
          if(home!=nullptr)
          cout << "HOME:" << home << endl;
        }
        break;
      }
    }
    if(!ret)
    {
      cout << "option " << argv[i] << " is not availabel!" << endl;
      return 1;
    }
  }
  return 0;
}
